package com.youchuang.action.user;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;

import com.opensymphony.xwork2.ActionSupport;
import com.youchuang.action.BaseAction;
import com.youchuang.common.Constant;
import com.youchuang.service.UserService;

/**
 * 用户地址的删除
 * 
 * @author Administrator
 *
 */
@Namespace(value = "/user")
@ParentPackage("shopping-default")
public class DelAddressAction extends BaseAction {
	private Logger logger = Logger.getLogger(DelAddressAction.class.getSimpleName());
	private String id;
	
	@Resource
	private UserService userService;

	@Action(value = "delAddress", results = { @Result(name = ActionSupport.SUCCESS, type = "redirectAction", params = {
			"namespace", "/user", "actionName", "selectAddress" }) })
	public String execute() throws Exception {

		logger.info("excetion is execute");
		// TODO:对地址进行加密，都是用post请求

		userService.deleteAddressActionById(id);

		return Constant.SUCCESS;
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}
	

}
